﻿<%@ Page Theme="POSSystem" Title="POSSystem | Product Images" Language="C#" MasterPageFile="~/Application.Master"
    AutoEventWireup="true" CodeBehind="ProductImage.aspx.cs" Inherits="WebUI.ProductImage" %>

<%@ Register Src="~/Controls/SysControls/LightBoxGallery.ascx" TagName="LightBoxGallery"
    TagPrefix="uc" %>
<%@ Register Src="~/Controls/SysControls/PageHeader.ascx" TagPrefix="uc" TagName="PageHeader" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ApplicationHeadHolder" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ApplicationContentHolder" runat="server">
    <script type="text/javascript">
        function onUploadImage() {
            var hidPicture = document.getElementById("<%=hidPicture.ClientID %>");
            var hidThumbnail = document.getElementById("<%=hidThumbnail.ClientID %>");
            var hidDesc = document.getElementById("<%=hidDesc.ClientID %>");
            var fileNames = window.showModalDialog('EditPages/Uploader.aspx', '', 'dialogWidth=640px;dialogHeight=480px;resizable=no;help=no;unadorned=yes;');

            if (fileNames != '' && fileNames != undefined) {
                var files = fileNames.split("|");
                hidThumbnail.value = files[0];
                hidPicture.value = files[1];
                hidDesc.value = files[2];
                document.getElementById("<%=btnPicture.ClientID %>").click();
            }
        }
    </script>
    <uc:PageHeader ID="pageHeader" Text="Product Images" ImageURL="~/Images/Product.png"
        runat="server" />
    <table width="100%">
        <tr>
            <td style="width: 100%; text-align: left; vertical-align: top">
                <asp:Panel ID="panel" runat="server" class="primaryPanel">
                    <div class="titleBar">
                        <asp:Label ID="lblTitle1" runat="server" CssClass="titleContent">Image List</asp:Label>
                    </div>
                    <div class="primaryFrameNoBorder">
                        <div>
                            <asp:UpdatePanel ID="update1" runat="server" UpdateMode="Conditional">
                                <ContentTemplate>
                                    <table width="100%" class="toolbar">
                                        <tr>
                                            <td style='vertical-align: middle; width: 425px; text-align: left'>
                                                <asp:Label ID="label10" runat="server" Text="Category"></asp:Label>
                                                <asp:DropDownList AutoPostBack="true" OnSelectedIndexChanged="ddlCategory_OnSelectedIndexChanged"
                                                    ID="ddlCategory" Width="100px" runat="server">
                                                </asp:DropDownList>
                                                <asp:Label ID="label1" runat="server" Text="Product"></asp:Label>
                                                <asp:DropDownList AutoPostBack="true" OnSelectedIndexChanged="ddlProduct_OnSelectedIndexChanged"
                                                    ID="ddlProduct" Width="200px" runat="server">
                                                    <asp:ListItem Text="--Select--" Value=""></asp:ListItem>
                                                </asp:DropDownList>
                                                <img src="Images/tbSep.png" />
                                            </td>
                                            <td style='vertical-align: middle; text-align: left'>
                                                <asp:LinkButton class="tbbutton" ID="btnSearchProduct" runat="server" OnClientClick="onUploadImage(); return false;">
                                                    <img src="Images/upload.png" />
                                                    <asp:Label Text="Upload" runat="server"></asp:Label>
                                                </asp:LinkButton>
                                            </td>
                                        </tr>
                                    </table>
                                </ContentTemplate>
                            </asp:UpdatePanel>
                            <p>
                            </p>
                            <asp:UpdatePanel ID="updateGrid" runat="server" UpdateMode="Conditional">
                                <ContentTemplate>
                                    <asp:HiddenField ID="hidPicture" runat="server" />
                                    <asp:HiddenField ID="hidThumbnail" runat="server" />
                                    <asp:HiddenField ID="hidDesc" runat="server" />
                                    <asp:Button Style="display: none" ID="btnPicture" runat="server" OnClick="btnUploadFinish_OnClick" />
                                    <uc:LightBoxGallery OnRenamePicture="gallery_OnRenamePicture" OnDeletePicture="gallery_OnDeletePicture" OnSetDefaultPicture="gallery_OnSetDefaultPicure" DefaultField="Default" RepeatColumns="5" RepeatLayout="Table" ID="gallery" runat="server"
                                        OriginalField="OriginalUrl" ThumbField="ThumbUrl" DescriptionField="Description"
                                        IDField="ID" />
                                </ContentTemplate>
                            </asp:UpdatePanel>
                        </div>
                    </div>
                </asp:Panel>
            </td>
        </tr>
    </table>
</asp:Content>
